home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 40
/
Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso
/
Aminet
/
util
/
cdity
/
ModeProSrc.lha
/
Prefs
/
MPPGadgets.c
< prev
next >
Wrap
C/C++ Source or Header
|
2000-09-17
|
22KB
|
770 lines
#define CATCOMP_ARRAY
#include "MPP.h"
#include "mppexterns.h"
//#include <extras/gui.h>
#include <utility/hooks.h>
#include <intuition/sghooks.h>
#include <intuition/gadgetclass.h>
#include <proto/locale.h>
#include <proto/utility.h>
#include <extras/ext_text.h>
#include <ctype.h>
#include <debug.h>
void InitNewMenus(struct NewMenu *NM);
extern struct NewMenu pr_PaletteMenu[];
extern struct Window *Win;
extern struct DrawInfo *DrawInfo;
extern APTR VI;
extern float XScale,YScale;
char __stdiowin[]="";
/* Errors strings for OpenLibs() */
STRPTR LibErrorString,
LibNameVerFmt,
LibOk;
extern struct LocaleBase *LocaleBase;
extern struct Catalog *Catalog;
UBYTE PenNameGad[32];
struct NewMenu nm[]=
{
{NM_TITLE ,(STRPTR)MSG_M_PROJECT ,0 ,0,0,0},
{NM_ITEM ,(STRPTR)MSG_MI_PROJECT_OPEN ,(STRPTR)MSG_MI_PROJECT_OPEN_KEY ,0,0,(APTR)M_OPEN},
{NM_ITEM ,(STRPTR)MSG_MI_PROJECT_SAVE_AS ,(STRPTR)MSG_MI_PROJECT_SAVE_AS_KEY ,0,0,(APTR)M_SAVEAS},
{NM_ITEM ,NM_BARLABEL ,0 ,0,0,0},
{NM_ITEM ,(STRPTR)MSG_MI_PROJECT_IMPORT ,(STRPTR)MSG_MI_PROJECT_IMPORT_KEY ,0,0,(APTR)M_IMPORT},
{NM_ITEM ,NM_BARLABEL ,0 ,0,0,0},
{NM_ITEM ,(STRPTR)MSG_MI_PROJECT_ABOUT ,(STRPTR)MSG_MI_PROJECT_ABOUT_KEY ,0,0,(APTR)M_ABOUT},
{NM_ITEM ,NM_BARLABEL ,0 ,0,0,0},
{NM_ITEM ,(STRPTR)MSG_MI_PROJECT_HIDE ,(STRPTR)MSG_MI_PROJECT_HIDE_KEY ,0,0,(APTR)M_HIDE},
{NM_ITEM ,NM_BARLABEL ,0 ,0,0,0},
{NM_ITEM ,(STRPTR)MSG_MI_PROJECT_QUIT ,(STRPTR)MSG_MI_PROJECT_QUIT_KEY ,0,0,(APTR)M_QUIT},
{NM_TITLE ,(STRPTR)MSG_M_EDIT ,0 ,0,0,0},
{NM_ITEM ,(STRPTR)MSG_MI_EDIT_LAST_SAVED ,(STRPTR)MSG_MI_EDIT_LAST_SAVED_KEY ,0,0,(APTR)M_LASTSAVED},
{NM_ITEM ,(STRPTR)MSG_MI_EDIT_RESTORE ,(STRPTR)MSG_MI_EDIT_RESTORE_KEY ,0,0,(APTR)M_RESTORE},
{NM_ITEM ,NM_BARLABEL ,0 ,0,0,0},
{NM_ITEM ,(STRPTR)MSG_MI_EDIT_COPY_TO ,(STRPTR)0 ,0,0,(APTR)M_COPY_TO},
{NM_SUB ,(STRPTR)MSG_MS_EDIT_COPY_SCR ,(STRPTR)MSG_MS_EDIT_COPY_SCR_KEY ,0,0,(APTR)M_COPY_TO_SCR},
{NM_SUB ,(STRPTR)MSG_MS_EDIT_COPY_PRG ,(STRPTR)MSG_MS_EDIT_COPY_PRG_KEY ,0,0,(APTR)M_COPY_TO_PRG},
{NM_SUB ,(STRPTR)MSG_MS_EDIT_COPY_SMODE ,(STRPTR)MSG_MS_EDIT_COPY_SMODE_KEY ,0,0,(APTR)M_COPY_TO_SMODE},
{NM_SUB ,(STRPTR)MSG_MS_EDIT_COPY_PUB ,(STRPTR)MSG_MS_EDIT_COPY_PUB_KEY ,0,0,(APTR)M_COPY_TO_PUB},
{NM_ITEM ,NM_BARLABEL ,0 ,0,0,0},
{NM_ITEM ,(STRPTR)MSG_MI_EDIT_SORT_LIST ,(STRPTR)MSG_MI_EDIT_SORT_LIST_KEY ,0,0,(APTR)M_SORT},
{NM_TITLE ,(STRPTR)MSG_M_SETTINGS ,0 ,0,0,0},
{NM_ITEM ,(STRPTR)MSG_MI_PROJECT_ENABLE_PROMO,(STRPTR)MSG_MI_PROJECT_ENABLE_PROMO_KEY,CHECKIT|MENUTOGGLE|CHECKED,0,(APTR)M_ENABLED},
{NM_ITEM ,(STRPTR)MSG_MI_PROJECT_ENABLE_NLM ,(STRPTR)MSG_MI_PROJECT_ENABLE_NLM_KEY ,CHECKIT|MENUTOGGLE|CHECKED,0,(APTR)M_ENABLENL},
{NM_ITEM ,NM_BARLABEL ,0 ,0,0,0},
{NM_ITEM ,(STRPTR)MSG_MI_SETTINGS_UNKNOWN ,(STRPTR)MSG_MI_SETTINGS_UNKNOWN_KEY ,CHECKIT|MENUTOGGLE,0,(APTR)M_SET_UNKNOWN},
{NM_ITEM ,(STRPTR)MSG_MI_SETTINGS_UNKNOWN_PUB ,(STRPTR)MSG_MI_SETTINGS_UNKNOWN_PUB_KEY ,CHECKIT|MENUTOGGLE,0,(APTR)M_SET_UNKNOWN_PUB},
{NM_ITEM ,(STRPTR)MSG_MI_SETTINGS_CENTER ,(STRPTR)0 ,CHECKIT|MENUTOGGLE,0,(APTR)M_SET_CENTER},
{NM_SUB ,(STRPTR)MSG_MS_SETTINGS_CENTER_H ,(STRPTR)MSG_MS_SETTINGS_CENTER_H_KEY ,CHECKIT|MENUTOGGLE,0,(APTR)M_SET_CENTER_H},
{NM_SUB ,(STRPTR)MSG_MS_SETTINGS_CENTER_V ,(STRPTR)MSG_MS_SETTINGS_CENTER_V_KEY ,CHECKIT|MENUTOGGLE,0,(APTR)M_SET_CENTER_V},
{NM_END ,NULL ,0 ,0,0,0}
};
struct GUI_String GText[]=
{
198 ,(STRPTR)MSG_G_UK_NEW_ENTRY,
198 ,(STRPTR)MSG_G_UK_ENTRY_TYPE,
112 ,(STRPTR)MSG_G_UK_SAVE_USE,
112 ,(STRPTR)MSG_G_UK_USE_DELETE,
112 ,(STRPTR)MSG_G_UK_NEVER_AGAIN,
112 ,(STRPTR)MSG_G_UK_CANCEL,
170 ,(STRPTR)MSG_G_PROGRAM_NAMES,
170 ,(STRPTR)MSG_G_SCREEN_NAMES,
170 ,(STRPTR)MSG_G_SCREEN_MODES,
170 ,(STRPTR)MSG_G_PUBLIC_SCREENS,
82 ,(STRPTR)MSG_G_NEW,
82 ,(STRPTR)MSG_G_REMOVE,
180 ,(STRPTR)MSG_G_SELECT_NAME,
80 ,(STRPTR)MSG_G_PROMOTION,
160 ,(STRPTR)MSG_G_PROMOTE_USE_PROG_DEFAULTS,
160 ,(STRPTR)MSG_G_PROMOTE_MONITOR_TYPE,
160 ,(STRPTR)MSG_G_PROMOTE_SCREEN_MODE,
160 ,(STRPTR)MSG_G_PROMOTE_USE_REQUESTER,
160 ,(STRPTR)MSG_G_PROMOTE_BEST_MODE, // <----------// (4.57.16)
218 ,(STRPTR)MSG_G_UNKNOWN_PROMOTION_MODE,
218 ,(STRPTR)MSG_G_SELECT_SCREEN_MODE,
82 ,(STRPTR)MSG_G_OVERSCAN,
128 ,(STRPTR)MSG_G_OS_TEXT_SIZE,
128 ,(STRPTR)MSG_G_OS_GRAPHICS_SIZE,
128 ,(STRPTR)MSG_G_OS_EXTREME_SIZE,
128 ,(STRPTR)MSG_G_OS_MAXIMUM_SIZE,
56 ,(STRPTR)MSG_G_WIDTH,
64 ,(STRPTR)MSG_G_HEIGHT,
72 ,(STRPTR)MSG_G_COLORS,
32 ,(STRPTR)MSG_G_256,
190 ,(STRPTR)MSG_G_AUTOSCROLL,
82 ,(STRPTR)MSG_G_CENTER,
190 ,(STRPTR)MSG_G_INTERLEAVE,
190 ,(STRPTR)MSG_G_FORCE_PLANAR,
190 ,(STRPTR)MSG_G_BLANK_BORDER,
190 ,(STRPTR)MSG_G_BEHIND,
82 ,(STRPTR)MSG_G_PALETTE,
126 ,(STRPTR)MSG_G_EDIT_PALETTE,
120 ,(STRPTR)MSG_G_CENTER_NO,
120 ,(STRPTR)MSG_G_CENTER_HORZ,
120 ,(STRPTR)MSG_G_CENTER_VERT,
120 ,(STRPTR)MSG_G_CENTER_BOTH ,
100 ,(STRPTR)MSG_G_FONT,
100 ,(STRPTR)MSG_G_FONT_PROGRAM,
100 ,(STRPTR)MSG_G_FONT_SYSTEM,
100 ,(STRPTR)MSG_G_FONT_SPECIFY,
218 ,(STRPTR)MSG_G_FONT_SELECT,
200 ,(STRPTR)MSG_G_FONT_FIX_ASPECT,
137 ,(STRPTR)MSG_G_3D_LOOK,
163 ,(STRPTR)MSG_G_3D_RESET,
150 ,(STRPTR)MSG_G_3D_DETAIL,
150 ,(STRPTR)MSG_G_3D_BLOCK,
150 ,(STRPTR)MSG_G_3D_TEXT,
150 ,(STRPTR)MSG_G_3D_SHINE,
150 ,(STRPTR)MSG_G_3D_SHADOW,
150 ,(STRPTR)MSG_G_3D_FILL,
150 ,(STRPTR)MSG_G_3D_FILL_TEXT,
150 ,(STRPTR)MSG_G_3D_BACKGROUND,
150 ,(STRPTR)MSG_G_3D_HIGHLIGHT_TEXT,
150 ,(STRPTR)MSG_G_3D_BAR_DETAIL,
150 ,(STRPTR)MSG_G_3D_BAR_BLOCK,
150 ,(STRPTR)MSG_G_3D_BAR_TRIM,
146 ,(STRPTR)MSG_G_MAKE_PUBLIC,
85 ,(STRPTR)MSG_G_PUB_NAME,
146 ,(STRPTR)MSG_G_SHARE_PENS,
85 ,(STRPTR)MSG_G_SP_EXCLUDE,
146 ,(STRPTR)MSG_G_DO_HOTKEY,
85 ,(STRPTR)MSG_G_HOTKEY,
42 ,(STRPTR)MSG_G_BACKDROPFILE,
146 ,(STRPTR)MSG_G_BACKDROPCENTER,
76 ,(STRPTR)MSG_G_BACKDROP_OPT_NONE,
76 ,(STRPTR)MSG_G_BACKDROP_OPT_PICTURE,
76 ,(STRPTR)MSG_G_BACKDROP_OPT_COLOR,
163 ,(STRPTR)MSG_G_BACKDROP_COLOR,
0 ,NULL,
};
UBYTE PenNames[DRIPENS][32];
WORD PenNameLength[DRIPENS];
UWORD PenNumbers[]=
{
DETAILPEN,
BLOCKPEN,
TEXTPEN,
SHINEPEN,
SHADOWPEN,
FILLPEN,
FILLTEXTPEN,
BACKGROUNDPEN,
HIGHLIGHTTEXTPEN,
BARDETAILPEN,
BARBLOCKPEN,
BARTRIMPEN
/*
,12,
13,
14*/
};
extern STRPTR BackdropLabels[];
extern STRPTR ForcedEditLabels[];
UBYTE *ListLabels[]=
{
(UBYTE *)MSG_G_SCREEN_NAMES,
(UBYTE *)MSG_G_PROGRAM_NAMES,
(UBYTE *)MSG_G_SCREEN_MODES,
(UBYTE *)MSG_G_PUBLIC_SCREENS,
NULL
};
UBYTE *ModeSelLabels[]=
{
(UBYTE *)MSG_G_PROMOTE_USE_PROG_DEFAULTS,
(UBYTE *)MSG_G_PROMOTE_MONITOR_TYPE,
(UBYTE *)MSG_G_PROMOTE_SCREEN_MODE,
(UBYTE *)MSG_G_PROMOTE_USE_REQUESTER,
(STRPTR) MSG_G_PROMOTE_BEST_MODE, // <----------// (4.57.2)
NULL
};
UBYTE *OverscanLabels[]=
{
(UBYTE *)MSG_G_OS_TEXT_SIZE,
(UBYTE *)MSG_G_OS_GRAPHICS_SIZE,
(UBYTE *)MSG_G_OS_EXTREME_SIZE,
(UBYTE *)MSG_G_OS_MAXIMUM_SIZE,
NULL
};
UBYTE *SFontLabels[]=
{
(STRPTR)MSG_G_FONT_PROGRAM,
(STRPTR)MSG_G_FONT_SYSTEM,
(STRPTR)MSG_G_FONT_SPECIFY,
NULL
};
UBYTE *CenterLabels[]=
{
(STRPTR)MSG_G_CENTER_NO,
(STRPTR)MSG_G_CENTER_HORZ,
(STRPTR)MSG_G_CENTER_VERT,
(STRPTR)MSG_G_CENTER_BOTH,
NULL
};
STRPTR ColorStrings[]=
{
"Error",
"2",
"4",
"8",
"16",
"32",
"64",
"128",
"256",
"16 Bit",
"24 Bit",
"32 Bit"
};
ULONG __saveds __asm ExcludeHook(register __a0 struct Hook *hook,
register __a1 ULONG *Msg,
register __a2 struct SGWork *SW)
{
ULONG return_code=~0;
UWORD code;
if (*Msg == SGH_KEY)
{
if ((SW->EditOp == EO_REPLACECHAR) || (SW->EditOp == EO_INSERTCHAR))
{
code=SW->Code;
if((code<'0' || code >'9') && (code!=',' && code!=' ' && code!='-'))
{
SW->Actions |= SGA_BEEP;
SW->Actions &= ~SGA_USE;
}
}
else
{
/* UNKNOWN COMMAND
** hook should return zero if the command is not supported.
*/
return_code = 0;
}
}
return(return_code);
}
ULONG __saveds __asm PenValFunc(register __a0 struct Hook *hook,
register __a1 ULONG *Msg,
register __a2 struct SGWork *SW)
{
ULONG return_code=~0;
// kprintf("Msg %7ld - EditOp %8lx - SW->Code %7ld - IE->ieClass %4lx - IE->ieCode %4lx\n",*Msg,SW->EditOp,SW->Code,SW->IEvent->ie_Class,SW->IEvent->ie_Code);
if (*Msg == SGH_KEY)
{
switch(SW->EditOp)
{/*
case EO_REPLACECHAR:
case EO_INSERTCHAR:
code=SW->Code;
if((code<'0' || code >'9') && (code!='+' && code!='-'))
{
SW->Actions |= SGA_BEEP;
SW->Actions &= ~SGA_USE;
}
break;*/
case EO_NOOP:
if(SW->IEvent->ie_Class==IECLASS_RAWKEY)
{
switch(SW->IEvent->ie_Code)
{
case CURSORUP:
case CURSORDOWN:
SW->Code=SW->IEvent->ie_Code;
SW->Actions |= SGA_END;
SW->Actions &=~(SGA_NEXTACTIVE | SGA_PREVACTIVE);
break;
}
}
break;
default:
/* UNKNOWN COMMAND
** hook should return zero if the command is not supported.
*/
return_code = 0;
}
}
return(return_code);
}
STRPTR MiscText[]=
{
(STRPTR)MSG_ITEM_NEW_NAME,
(STRPTR)MSG_ITEM_NO_NAME,
(STRPTR)MSG_REQ_OK,
(STRPTR)MSG_REQ_LOAD_MP_PREFS,
(STRPTR)MSG_REQ_SAVE_MP_PREFS,
(STRPTR)MSG_REQ_LOAD_ERROR,
(STRPTR)MSG_REQ_SAVE_ERROR,
(STRPTR)MSG_REQ_SELECT_SCREEN_FONT,
(STRPTR)MSG_REQ_SELECT_SCREENMODE_FOR,
(STRPTR)MSG_G_UNKNOWN_PROMOTION_MODE,
(STRPTR)MSG_G_MILLION,
0
};
#define GetArrayStrings(x) for(l=0;x[l];l++) x[l]=GetString((LONG)x[l])
#define LST_X 5
#define LST_Y 4
#define OPT_X 209
#define OPT_Y 101
#define OPT_X2 (OPT_X + 116)
#define SCR_X 209
#define SCR_Y 4
#define FNT_X 209
#define FNT_Y 145
#define TDL_X 453
#define TDL_Y 4
#define SHR_X 453
#define SHR_Y 108
#define PUB_X 453
#define PUB_Y 140
#define HK_X 453
#define HK_Y 171
#define SUC_X 5
#define SUC_Y 202
struct TextArea
ColorDisp ={315,70,364,82,0,0,0},
PenNameDisp ={453,90,561,102,0,0,0},
FontDisp ={FNT_X+2, FNT_Y+26+2, FNT_X + 234-3, FNT_Y+38-2,0,0,0};
WORD BevelBoxes=8;
/*
struct BevelBox BBox[]=
{
209, 97, 239, 2, BBSCALE_WIDTH,
448, 104, 175, 2, BBSCALE_WIDTH,
448, 136, 175, 2, BBSCALE_WIDTH,
209, 141, 239, 2, BBSCALE_WIDTH,
448, 167, 175, 2, BBSCALE_WIDTH,
446, 4, 4, 195, BBSCALE_HEIGHT,
5, 198, 619, 2, BBSCALE_WIDTH,
FNT_X, FNT_Y+26, 234, 12, BBSCALE_WIDTH | BBSCALE_HEIGHT
};
*/
struct BevelBox BBox[TOTAL_AREAS];
void InitStrings(void)
{
ULONG l;
/* Init GText Strings */
for(l=0;GText[l].String;l++)
GText[l].String = GetString((LONG)GText[l].String);
GetArrayStrings(ForcedEditLabels);
GetArrayStrings(MiscText);
GetArrayStrings(ListLabels);
GetArrayStrings(ModeSelLabels);
GetArrayStrings(OverscanLabels);
GetArrayStrings(SFontLabels);
GetArrayStrings(CenterLabels);
GetArrayStrings(BackdropLabels);
LibErrorString = GetString(MSG_REQ_COULDNT_OPEN_LIBS);
LibNameVerFmt = GetString(MSG_REQ_NAME_VER_FMT);
LibOk = MiscText[OK];
/* init menus */
InitNewMenus(nm);
InitNewMenus(pr_PaletteMenu);
/*
for(l=0;nm[l].nm_Type;l++)
{
if(nm[l].nm_Label != NM_BARLABEL)
{
nm[l].nm_Label =GetString((LONG)nm[l].nm_Label);
if(nm[l].nm_CommKey=GetString((LONG)nm[l].nm_CommKey))
{
switch(strlen(nm[l].nm_CommKey))
{
case 0:
nm[l].nm_CommKey=0;
break;
case 1:
break;
default:
nm[l].nm_Flags|=NM_COMMANDSTRING;
}
}
}
}
*/
for(l=0;l<DRIPENS;l++)
{
strncpy(PenNames[l],GetString((LONG)MSG_G_3D_DETAIL+l),24);
PenNames[l][24]=0;
PenNameLength[l]=strlen(PenNames[l]);
}
}
UBYTE NullStr[]={0};
STRPTR GetString(LONG stringNum)
{
struct CatCompArrayType *CCA;
STRPTR builtIn;
ULONG entries;
entries=sizeof(CatCompArray)/sizeof(struct CatCompArrayType);
if(!stringNum)
return(0);
CCA=CatCompArray;
while (CCA->cca_ID != stringNum && entries)
{
CCA++;
entries--;
}
builtIn = CCA->cca_Str;
if (LocaleBase)
return(GetCatalogStr(Catalog,stringNum,builtIn));
return(builtIn);
}
void WriteColorDisp(struct DefaultNode *DN)
{
UBYTE str[50];
ULONG colors;
if(ColorDisp.RightEdge>=ColorDisp.LeftEdge && ColorDisp.BottomEdge>=ColorDisp.TopEdge)
{
EraseRect(Win->RPort,ColorDisp.RightEdge-ColorDisp.PrevWidth ,ColorDisp.TopEdge,
ColorDisp.RightEdge ,ColorDisp.BottomEdge);
ColorDisp.PrevWidth=0;
if(DN)
{
if(DN->Flags & (DEPTH | DNF_PALETTE) && (DN->ModeSelect==MS_PROMOTE_SCREENMODE || DN->ModeSelect==MS_PROMOTE_REQUESTER || DN->ModeSelect==MS_PROMOTE_BEST_MODE))// (4.57.13)
{
SetAPen(Win->RPort,DrawInfo->dri_Pens[TEXTPEN]);// (4.57.22)
SetDrMd(Win->RPort,JAM1);// (4.57.22)
gui_RenderText(Win->RPort, ColorStrings[DepthToSlider[DN->Depth]],// (4.57.22)
RT_XPos , ColorDisp.RightEdge,// (4.57.22)
RT_Baseline , ColorDisp.Baseline,// (4.57.22)
RT_MaxWidth , ColorDisp.Width,// (4.57.22)
RT_Justification, RTJ_RIGHT,// (4.57.22)
RT_TextLength , &ColorDisp.PrevWidth,// (4.57.22)
TAG_DONE); // (4.57.22)
/*
colors=1<<DN->Depth;
if(colors>1)
{
if(colors>999999)
{
colors/=1000000;
stci_d(str,colors);
strcat(str," ");
strcat(str,MiscText[MT_MILLION]);
}
else
stci_d(str,colors);
SetAPen(Win->RPort,DrawInfo->dri_Pens[TEXTPEN]);
SetDrMd(Win->RPort,JAM1);
RenderText(Win->RPort,str,
RT_XPos , ColorDisp.RightEdge,
RT_Baseline , ColorDisp.Baseline,
RT_MaxWidth , ColorDisp.Width,
RT_Justification, RTJ_RIGHT,
RT_TextLength , &ColorDisp.PrevWidth,
TAG_DONE);
}
*/
}
}
}
}
void WritePenNameDisp(STRPTR Name)
{
if(PenNameDisp.RightEdge>=PenNameDisp.LeftEdge && PenNameDisp.BottomEdge>=PenNameDisp.TopEdge)
{
EraseRect(Win->RPort,PenNameDisp.RightEdge - PenNameDisp.PrevWidth ,PenNameDisp.TopEdge,
PenNameDisp.RightEdge ,PenNameDisp.BottomEdge);
PenNameDisp.PrevWidth=0;
SetAPen(Win->RPort,DrawInfo->dri_Pens[TEXTPEN]);
SetDrMd(Win->RPort,JAM1);
gui_RenderText(Win->RPort,Name,
RT_XPos , PenNameDisp.RightEdge,
RT_Baseline , PenNameDisp.Baseline,
RT_MaxWidth , PenNameDisp.Width,
RT_Justification, RTJ_RIGHT,
RT_TextLength , &PenNameDisp.PrevWidth,
TAG_DONE);
}
}
void WriteFontDisp(struct DefaultNode *DN)
{
UBYTE fontname[50];
UBYTE work[40];
LONG l;
if(FontDisp.RightEdge>=FontDisp.LeftEdge && FontDisp.BottomEdge>=FontDisp.TopEdge)
{
EraseRect(Win->RPort,FontDisp.LeftEdge ,FontDisp.TopEdge,
FontDisp.RightEdge ,FontDisp.BottomEdge);
DrawBevelBox(Win->RPort, FontDisp.LeftEdge,
FontDisp.TopEdge,
FontDisp.Width,
FontDisp.Height,
GTBB_Recessed, 1,
GTBB_FrameType, 1,
GT_VisualInfo, VI,
TAG_DONE);
FontDisp.PrevWidth=0;
if(DN)
{
if(DN->FontType==SFONT_MP)
{
if(DN->Font.tta_Name)
l=strlen(DN->Font.tta_Name)-5;
else
l=0;
l=max(0,l);
l=min(l,39);
if(l==0)
{
fontname[0]=0;
}
else
{
CopyMem(DN->Font.tta_Name,work,l);
work[l]=0;
sprintf(fontname,"%s/%d",work,DN->Font.tta_YSize);
}
SetAPen(Win->RPort,DrawInfo->dri_Pens[TEXTPEN]);
SetDrMd(Win->RPort,JAM1);
gui_RenderText(Win->RPort,fontname,
RT_XPos , FontDisp.LeftEdge+(FontDisp.Width>>1),
RT_Baseline , FontDisp.Baseline,
RT_MaxWidth , FontDisp.Width,
RT_Justification, RTJ_CENTER,
RT_TextLength , &FontDisp.PrevWidth,
TAG_DONE);
}
}
}
}
void MyBevelBox(struct RastPort *RP, WORD Left, WORD Top, WORD Width, WORD Height);
void RefreshGUI(void)
{
struct DefaultNode *dn;
ULONG l;
dn=GetActiveNode();
for(l=0;l<TOTAL_AREAS-1;l++)
{
/*
BBox[l].X=GadgetArea[l].Left-4;
BBox[l].Width=GadgetArea[l].Width+8;
BBox[l].Y=GadgetArea[l].Top-2;
BBox[l].Height=GadgetArea[l].Height+4;
BBox[l].Scale=2;
*/
MyBevelBox(Win->RPort,(GadgetArea[l].Left-3)*XScale+Win->BorderLeft,(GadgetArea[l].Top-3)*YScale+Win->BorderTop,(GadgetArea[l].Width+6)*XScale,(GadgetArea[l].Height+6)*YScale);
// DrawBevelBox(Win->RPort,(GadgetArea[l].Left-4)*XScale+Win->BorderLeft,(GadgetArea[l].Top-2)*YScale+Win->BorderTop,(GadgetArea[l].Width+8)*XScale,(GadgetArea[l].Height+4)*YScale,
// GTBB_Recessed, 1,
// GTBB_FrameType, 0,
// GT_VisualInfo, VI,
// TAG_DONE);
}
// DrawBevelBoxes(Win,VI,BBox,TOTAL_AREAS,XScale,YScale);
WriteColorDisp(dn);
WriteFontDisp(dn);
WritePenNameDisp(PenNameGad);
}
void MyBevelBox(struct RastPort *RP, WORD Left, WORD Top, WORD Width, WORD Height)
{
struct RastPort rp;
WORD Right,Bottom;
Right = Left + Width - 1;
Bottom = Top + Height - 1;
rp=*RP;
//#define SIMPLEGRP
#ifdef SIMPLEGRP
SetAPen(&rp,DrawInfo->dri_Pens[SHINEPEN]);
Move(&rp,Left , Bottom);
Draw(&rp,Left , Top);
Draw(&rp,Right , Top);
SetAPen(&rp,DrawInfo->dri_Pens[SHADOWPEN]);
Draw(&rp,Right , Bottom);
Draw(&rp,Left , Bottom);
#else
SetAPen(&rp,DrawInfo->dri_Pens[SHINEPEN]);
Move(&rp,Left+1 , Top+1);
Draw(&rp,Right , Top+1);
Draw(&rp,Right , Bottom);
Draw(&rp,Left+1 , Bottom);
Draw(&rp,Left+1 , Top+1);
SetAPen(&rp,DrawInfo->dri_Pens[SHADOWPEN]);
Move(&rp,Left , Top);
Draw(&rp,Right-1 , Top);
Draw(&rp,Right-1 , Bottom-1);
Draw(&rp,Left , Bottom-1);
Draw(&rp,Left , Top);
#endif
}
/*
struct BFBounds
{
struct Layer *Layer;
struct Rectangle Rect;
LONG OffsetX,
OffsetY;
};
struct Hook MainWinHook,
PaletteWinHook;
ULONG __saveds __asm WinBackFillHook(register __a0 struct Hook *Hook,
register __a1 struct BFBounds *BF,
register __a2 struct RastPort *RP)
{
SetAPen(RP,((LONG)Hook->h_Data)+1);
RectFill(RP, BF->Rect.MinX, BF->Rect.MinY,
BF->Rect.MaxX, BF->Rect.MaxY);
kprintf("%8lx %ld %ld %ld %ld %ld %ld\n",RP,BF->Rect.MinX,BF->Rect.MinY,BF->Rect.MaxX,BF->Rect.MaxY,BF->OffsetX,BF->OffsetY);
}
*/
/*
struct LG_RetVal MatchKey2Gad(ULONG Key, struct LetterGad *LG)
{
UWORD l;
UWORD c;
char *d;
struct LG_RetVal rv={0xffff,0xffff};
for(l=0;LG[l].String!=(STRPTR)~0;l++)
{
d=LG[l].String;
for(c=0;d[c];c++)
{
if(d[c]==Key)
{
rv.GadID=LG[l].GadID;
rv.Char =c;
return(rv);
}
}
}
return(rv);
}
*/
void InitNewMenus(struct NewMenu *NM)
{
ULONG l;
for(l=0;NM[l].nm_Type;l++)
{
if(NM[l].nm_Label != NM_BARLABEL)
{
NM[l].nm_Label =GetString((LONG)NM[l].nm_Label);
if(NM[l].nm_CommKey=GetString((LONG)NM[l].nm_CommKey))
{
switch(strlen(NM[l].nm_CommKey))
{
case 0:
NM[l].nm_CommKey=0;
break;
case 1:
break;
default:
NM[l].nm_Flags|=NM_COMMANDSTRING;
}
}
}
}
}